<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>核心事件列表</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <!--link导入外部的css，js样式，如果导入的资源和本页面在同一个文件夹下，直接文件名即可-->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- jQuery 3 -->
    <script th:src="@{/asserts/bower_components/jquery/dist/jquery.min.js}"></script>
    <!-- Bootstrap 3.3.7 -->
    <script th:src="@{/asserts/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- DataTables -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/AdminLTE.min.css}">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/skins/_all-skins.min.css}">
    <script th:src="@{/asserts/Apolar_sh/lib/layer/2.4/layer.js}"></script>


    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <style type="text/css">
        .search {
            margin-top: 40px;
            margin-left: 40px;
            position: relative;
        }

        td {
            text-align: center;
        }
    </style>

</head>
<body>


<div class="wrapper">
    <section class="content-header">
        <h4>
            <i class="fa fa-navicon"></i> 核心事件列表
        </h4>
        <a class="btn btn-info" th:if="${info != null}"
           th:href="@{/coreEvent/findGroup(campusId=${campusId},currentPage=${RcurrentPage},pageSize=${RpageSize})}">
            <i class="fa fa-backward"></i> 返回
        </a>
    </section>
</div>

<div class="wrapper">
    <!-- Content Wrapper. Contains page content -->
    <!-- Content Header (Page header) -->
    <div th:if="${info != null}" style="width: 270px;margin: auto">
        <p style="color: #ff0000;font-size: 30px;font-weight: bold">[[${info}]]</p>
    </div>

    <!-- Main content -->
    <section class="content" th:if="${info == null}">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <!-- /.box-header 部门列表的显示  table  表格  th/td单元个   th字体加粗，行标题-->
                    <div class="box-body">
                        <form th:action="@{/coreEvent/deleteAll(Gid=${Gid},campusId=${campusId},RcurrentPage=${RcurrentPage},RpageSize=${RpageSize})}"
                              method="post">
                            <table id="example1" class="table table-bordered table-striped">
                                <tbody>
                                <tr>
                                    <td th:if="${session.user.authority != 3}">选择</td>
                                    <td>核心事件</td>
                                    <td>开始时间</td>
                                    <td>规划达成时间</td>
                                    <td>实际达成时间</td>
                                    <td>备注</td>
                                    <td>操作</td>
                                </tr>
                                <tr th:each="coreEvent:${pageBean.list}">
                                    <td th:if="${session.user.authority != 3}">
                                        <input type="checkbox" name="coreEventIds" class="checks"
                                               th:value="${coreEvent.coreEventId}"/>
                                    </td>
                                    <td th:text="${coreEvent.coreEventName}">校院领导采访</td>
                                    <td th:text="${#dates.format(coreEvent.beginTime, 'yyyy-MM-dd')}">2019-06-29</td>
                                    <td th:text="${#dates.format(coreEvent.planTime, 'yyyy-MM-dd')}">2019-07-04</td>
                                    <td th:text="${#dates.format(coreEvent.completeTime, 'yyyy-MM-dd')}">2019-07-25</td>
                                    <td>
                                        <button type="button" class="btn btn-info" data-toggle="modal"
                                                th:data-target="'#'+${coreEvent.coreEventId}">
                                            <i class="fa fa-info"></i> 备注
                                        </button>
                                    </td>
                                    <td>
                                        <a class="btn btn-warning"
                                           th:href="@{/coreEvent/updateUI(Gid=${coreEvent.coreGroup},coreEventId=${coreEvent.coreEventId},RcurrentPage=${RcurrentPage},RpageSize=${RpageSize})}">
                                            <i class="fa fa-edit"></i> 修改
                                        </a>
                                        <a class="btn btn-danger" th:onclick="deleteById([[${coreEvent.coreEventId}]])"
                                           th:if="${session.user.authority != 3}"><i class="fa fa-trash"></i> 删除
                                        </a>

                                        <!-- Modal -->
                                        <div class="modal fade" th:id="${coreEvent.coreEventId}" tabindex="-1"
                                             role="dialog"
                                             aria-labelledby="myModalLabel">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-label="Close"><span
                                                                aria-hidden="true">&times;</span>
                                                        </button>
                                                        <h4 class="modal-title" id="myModalLabel">备注</h4>
                                                    </div>
                                                    <table>
                                                        <tr>
                                                            <td th:text="${coreEvent.coreRemarks}"></td>
                                                        </tr>
                                                    </table>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-primary"
                                                                data-dismiss="modal">
                                                            关闭
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td th:if="${session.user.authority != 3}">
                                        <label><input type="checkbox" name="" id="all" value=""/>&nbsp;&nbsp;全选</label>

                                    </td>
                                    <td colspan="13" style="text-align:left;padding-left:20px;">
                                        <button th:if="${session.user.authority != 3}" class="btn btn-danger"
                                                onclick="return confirm('确认要删除？')" type="submit">
                                            <i class="fa fa-trash"></i> 删除
                                        </button>&nbsp;&nbsp;
                                        <a class="btn btn-info"
                                           th:href="@{/coreEvent/findGroup(campusId=${campusId},currentPage=${RcurrentPage},pageSize=${RpageSize})}">
                                            <i class="fa fa-backward"></i> 返回
                                        </a>
                                    </td>
                                </tr>
                                <tr>

                                </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>

                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>

<!-- ./wrapper -->


<!-- DataTables -->
<script th:src="@{/asserts/bower_components/datatables.net/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/asserts/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js}"></script>
<!-- SlimScroll -->
<script th:src="@{/asserts/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<!-- FastClick -->
<script th:src="@{/asserts/bower_components/fastclick/lib/fastclick.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/asserts/dist/js/adminlte.min.js}"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/asserts/dist/js/demo.js}"></script>
<!-- page script -->

<script>

       $("#all").click(function () {
        if (this.checked) {
            $(".checks").prop("checked", true);
            $("#all").prop("value", "全不选");
        } else {
            $(".checks").prop("checked", false);
            $("#all").prop("value", "全选");
        }
    });
    function deleteById(coreEventId) {
        layer.confirm("确认删除？",
            {
                btn: ['确定', '取消'] //按钮
            },
            function () {
                $.ajax({
                    url: "[[${#httpServletRequest.getContextPath()}]]/coreEvent/delete",
                    data: {
                        'coreEventId': coreEventId
                    },
                    success: function (result) {
                        console.log(result);
                        if (result == '1') {
                            layer.msg('删除成功！', {icon: 0, time: 1000});

                        } else {
                            layer.msg('删除失败！', {icon: 0, time: 1000});
                        }
                        location.reload();
                    }
                })
            },
            function () {
                layer.msg('已取消！', {icon: 0, time: 500});
                return false;
            }
        );
    };
</script>
</body>
</html>